package com.jyw.business.de.domain.dto.web;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.jyw.business.de.domain.DeDemandMake;
import com.jyw.common.annotation.Excel;
import com.jyw.common.utils.DateUtils;
import com.jyw.common.utils.SecurityUtils;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("需求处理请求实体")
public class DemandMakeDto {


    /** 需求主键 */
    @ApiModelProperty("需求主键")
    @NotNull(message = "需求主键不能为空")
    private Long demandId;

    /** 处理描述 */
    @ApiModelProperty("处理描述")
    @NotEmpty(message = "处理描述不能为空")
    private String makeRemark;

    /** 需求进度(整数0-100) */
    @ApiModelProperty("需求进度(整数0-100)")
    @NotNull(message = "处理进度不能为空")
    private Integer makeProcess;

    /** 附件 */
    @ApiModelProperty("附件")
    private List<SimpleFileVo> makeEnclosure;

    public DeDemandMake buildMake() {
        DeDemandMake make = new DeDemandMake();
        BeanUtils.copyProperties(this,make);
        make.setMakeEnclosure(FileUtils.fileToId(getMakeEnclosure()));
        make.setCreateUser(SecurityUtils.getUserId());
        make.setCreateTime(DateUtils.getNowDate());
        return make;
    }
}
